package ah.file;

public class FilePath {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new FilePath().getFilePath();

	}
	public void getFilePath() {
		java.net.URL url = FilePath.this.getClass().getProtectionDomain().getCodeSource().getLocation();
		String filePath = null;
		try {
		filePath = java.net.URLDecoder.decode(url.getPath(), "utf-8");
		} catch (Exception e) {
		e.printStackTrace();
		}
		if (filePath.endsWith(".jar"))
		filePath = filePath.substring(0, filePath.lastIndexOf("/") + 1);
		java.io.File file = new java.io.File(filePath);
		filePath = file.getAbsolutePath();
		System.out.println(filePath);
	}
}
